All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.JApplet
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----java.applet.Applet
|
+----com.sun.java.swing.JApplet
- public class JApplet
- extends Applet
- implements Accessible, RootPaneContainer
An extended version of java.applet.Applet that adds support for
interposing input and painting behavior in front of the applets
children (see glassPane), support for special children that
are managed by a LayeredPane (see rootPane) and for Swing MenuBars.
The JApplet class is slightly incompatible with java.applet.Applet.
JApplet contains a JRootPane as it's only child.
The contentPane should be the parent of any children of the JApplet.
This is different than java.applet.Applet, e.g. to add a child to
an an java.applet.Applet you'd write:
applet.add(child);
However using JApplet you need to add the child to the JApplet's contentPane
instead:
applet.getContentPane().add(child);
The same is true for setting LayoutManagers, removing components,
listing children, etc. All these methods should normally be sent to
the contentPane() instead of the JApplet itself. The contentPane() will
always be non-null. Attempting to set it to null will cause the JApplet
to throw an exception. The default contentPane() will have a BorderLayout
manager set on it.
Please see the JRootPane documentation for a complete description of
the contentPane, glassPane, and layeredPane properties.
For the keyboard keys used by this component in the standard Look and
Feel (L&F) renditions, see the
JApplet key assignments.
Both Netscape Communicator and Internet Explorer 4.0 unconditionally
print an error message to the Java console when an applet attempts
to access the AWT system event queue. Swing applets do this once,
to check if access is permitted. To prevent the warning message in
a production applet one can set a client property called
"defeatSystemEventQueueCheck" on the JApplets RootPane to any
non null value, e.g:
JRootPane rp = myJApplet.getRootPane();
rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
We hope that future versions of the browsers will not have this
limitation and we'll be able to retire this hack.
Warning: serialized objects of this class will not be compatible with
future swing releases. The current serialization support is appropriate
for short term storage or RMI between Swing1.0 applications. It will
not be possible to load serialized Swing1.0 objects with future releases
of Swing. The JDK1.2 release of Swing will be the compatibility
baseline for the serialized form of Swing objects.
-
accessibleContext
-
-
rootPane
-
-
rootPaneCheckingEnabled
-
-
JApplet()
- Creates a swing applet instance.
-
addImpl(Component, Object, int)
- By default, children may not be added directly to a this component,
they must be added to its contentPane instead.
-
createRootPane()
- Called by the constructor methods to create the default rootPane.
-
getAccessibleContext()
- Get the AccessibleContext associated with this JApplet
-
getContentPane()
- Returns the contentPane object for this applet.
-
getGlassPane()
- Returns the glassPane object for this applet.
-
getJMenuBar()
- Returns the menubar set on this applet.
-
getLayeredPane()
- Returns the layeredPane object for this applet.
-
getRootPane()
- Returns the rootPane object for this applet.
-
isRootPaneCheckingEnabled()
-
-
processKeyEvent(KeyEvent)
-
-
setContentPane(Container)
- Sets the contentPane property.
-
setGlassPane(Component)
- Sets the glassPane property.
-
setJMenuBar(JMenuBar)
- Sets the menubar for this applet.
-
setLayeredPane(JLayeredPane)
- Sets the layeredPane property.
-
setLayout(LayoutManager)
- By default the layout of this component may not be set,
the layout of its contentPane should be set instead.
-
setRootPane(JRootPane)
- Sets the rootPane property.
-
setRootPaneCheckingEnabled(boolean)
- If true then calls to add() and setLayout() will cause an exception
to be thrown.
-
update(Graphics)
-
Just calls
paint(g)
.
rootPane
protected JRootPane rootPane
- See Also:
- getRootPane, setRootPane
rootPaneCheckingEnabled
protected boolean rootPaneCheckingEnabled
- See Also:
- isRootPaneCheckingEnabled, setRootPaneCheckingEnabled
accessibleContext
protected AccessibleContext accessibleContext
JApplet
public JApplet()
- Creates a swing applet instance.
createRootPane
protected JRootPane createRootPane()
- Called by the constructor methods to create the default rootPane.
processKeyEvent
protected void processKeyEvent(KeyEvent e)
- Overrides:
- processKeyEvent in class Component
update
public void update(Graphics g)
- Just calls
paint(g)
. This method was overridden to
prevent an unneccessary call to clear the background.
- Overrides:
- update in class Container
setJMenuBar
public void setJMenuBar(JMenuBar menuBar)
- Sets the menubar for this applet.
- Parameters:
- menubar - the menubar being placed in the applet
- See Also:
- getJMenuBar
getJMenuBar
public JMenuBar getJMenuBar()
- Returns the menubar set on this applet.
- See Also:
- setJMenuBar
isRootPaneCheckingEnabled
protected boolean isRootPaneCheckingEnabled()
- Returns:
- true if add and setLayout should be checked
- See Also:
- addImpl, setLayout, setRootPaneCheckingEnabled
setRootPaneCheckingEnabled
protected void setRootPaneCheckingEnabled(boolean enabled)
- If true then calls to add() and setLayout() will cause an exception
to be thrown.
- See Also:
- addImpl, setLayout, isRootPaneCheckingEnabled
addImpl
protected void addImpl(Component comp,
Object constraints,
int index)
- By default, children may not be added directly to a this component,
they must be added to its contentPane instead. For example:
thiComponent.getContentPane().add(child)
An attempt to add to directly to this component will cause an
runtime exception to be thrown. Subclasses can disable this
behavior.
- Throws: Error
- if called with rootPaneChecking true
- Overrides:
- addImpl in class Container
- See Also:
- setRootPaneCheckingEnabled
setLayout
public void setLayout(LayoutManager manager)
- By default the layout of this component may not be set,
the layout of its contentPane should be set instead.
For example:
thiComponent.getContentPane().setLayout(new BorderLayout())
An attempt to set the layout of this component will cause an
runtime exception to be thrown. Subclasses can disable this
behavior.
- Throws: Error
- if called with rootPaneChecking true
- Overrides:
- setLayout in class Container
- See Also:
- setRootPaneCheckingEnabled
getRootPane
public JRootPane getRootPane()
- Returns the rootPane object for this applet.
- See Also:
- setRootPane, getRootPane
setRootPane
protected void setRootPane(JRootPane root)
- Sets the rootPane property. This method is called by the constructor.
- Parameters:
- root - the rootPane object for this applet
- See Also:
- getRootPane
getContentPane
public Container getContentPane()
- Returns the contentPane object for this applet.
- See Also:
- setContentPane, getContentPane
setContentPane
public void setContentPane(Container contentPane)
- Sets the contentPane property. This method is called by the constructor.
- Parameters:
- contentPane - the contentPane object for this applet
- Throws: IllegalComponentStateException
- (a runtime
exception) if the content pane parameter is null
- See Also:
- getContentPane, setContentPane
getLayeredPane
public JLayeredPane getLayeredPane()
- Returns the layeredPane object for this applet.
- Throws: IllegalComponentStateException
- (a runtime
exception) if the layered pane parameter is null
- See Also:
- setLayeredPane, getLayeredPane
setLayeredPane
public void setLayeredPane(JLayeredPane layeredPane)
- Sets the layeredPane property. This method is called by the constructor.
- Parameters:
- layeredPane - the layeredPane object for this applet
- See Also:
- getLayeredPane, setLayeredPane
getGlassPane
public Component getGlassPane()
- Returns the glassPane object for this applet.
- See Also:
- setGlassPane, getGlassPane
setGlassPane
public void setGlassPane(Component glassPane)
- Sets the glassPane property.
This method is called by the constructor.
- Parameters:
- glassPane - the glassPane object for this applet
- See Also:
- getGlassPane, setGlassPane
getAccessibleContext
public AccessibleContext getAccessibleContext()
- Get the AccessibleContext associated with this JApplet
- Returns:
- the AccessibleContext of this JApplet
All Packages Class Hierarchy This Package Previous Next Index